package com.yugao.fintech.draper.auth.api;

import com.yugao.fintech.draper.common.constant.ServerConstant;
import com.yugao.fintech.draper.core.constant.SecurityConstants;
import com.yugao.fintech.draper.core.model.DeptDataScopeDTO;
import com.yugao.fintech.draper.core.model.ResultVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.Set;

@FeignClient(contextId = "authFeignApi", value = ServerConstant.DRAPER_ADMIN)
public interface AuthFeignApi {
	/**
	 * 获取当前用户角色下的数据权限
	 */
	@GetMapping("/role/getDataPermission")
	ResultVO<DeptDataScopeDTO> getDataPermission();

	/**
	 * 通过用户名查询权限信息
	 * @param username 用户名称
	 * @return 权限信息
	 */
	@GetMapping("/menu/findUserPermissions/{username}")
	ResultVO<Set<String>> findUserPermissions(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM) String from);

}
